in reply to Re: Compact data classes
in thread Compact data classes
Why does your solution use a compiled (eval) class? Is this faster or does it save memory vs. a solution like roboticus proposes?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Compact data classes
by BrowserUk (Patriarch) on Jun 10, 2013 at 18:12 UTC | |
Because it allows me to 'hardcode' the numbers in the substrs. If you uncomment the print before the eval, you'll see something like:
F4_N() and F4_L() are constant subs which get optimised away during compilation, leaving hardcoded numbers which are faster than variables. The memory saving comes from packing the fields into single strings; the performance comes from asking the sub to do as little as possible. That said, by explaining that, I've spotted another couple of optimisations; and a potential bug. I'll get back to you with a revised version 2 days from now. (A good reason for not uploading to cpan straight away :) With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
by creeble (Sexton) on Jun 10, 2013 at 18:46 UTC | |
FWIW, I don't need the lvalue-ness of the accessors, setting them with param(value) makes me totally happy, especially if it saves anything. I'm embarrassed to say I've never seen the ":lvalue" attribute in use, which is rather nifty. This is so promising. I really appreciate your expertise on this; I've tried various solutions like roboticus proposed, but performance has been unusable. | [reply] |
by BrowserUk (Patriarch) on Jun 23, 2013 at 05:38 UTC | |
Try this. It fixes a potential bug and adds the ability to get greater compression for numeric fields. It needs more testing, diagnostics and documentation, but suck it and see if it satisfies.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |