|
Boost : |
From: Phil Richards (news_at_[hidden])
Date: 2004-01-27 16:53:02
On Fri, 23 Jan 2004 16:54:14 -0500, David Abrahams wrote:
[I wrote:]
>> I'll have a look at zip_view, but on first looks it doesn't exactly look
>> simple :-)
> Replacing lambda expressions with metafunction classes would be my first
> strategy.
Well, I replaced zip_view with transform and got the following
(non-scientific) results:
% time g++ -Wall -W -I. -I/home/pgr/src/boost -DWITH_ZIP_VIEW pq.cpp -c
real 0m59.201s
user 0m56.444s
sys 0m0.475s
[without zip_view, using transform]
% time g++ -Wall -W -I. -I/home/pgr/src/boost pq.cpp -c
real 0m14.074s
user 0m13.418s
sys 0m0.372s
Well, that's much better. (Though there is probably still some room for
improvement yet - it's still 3 or 4 fold slower than without the MPL.)
How difficult would it be to produce a full family of mpl transform
functions? Currently, there are the 1 and 2 sequence forms, but I could
use a 3 sequence version :-) (The multi-sequence version is what I would
have called "zip_with" from my old F.P. days...)
Given the progress I've made, I will put together yet another release of
my library.
This version allows user choice of the base units in their dimensional
analysis (so if you want bananas/second you can have it). It still uses
fixed-size vectors of powers, though - so if you have a banana-system and
you want to multiply a banana-system-based quantity by a "physical
system"-based quantity, it won't let you. Personally, that's the way I
like it...
phil
-- change name before "@" to "phil" for email
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk