in reply to Re^5: Faster creation of Arrays in XS?
in thread Faster creation of Arrays in XS?
I know from experience that accessing individual bits in Perl ... is far slower than unpacking integers from a packed array.
Using bitvectors in pure Perl can be fast. See Tuning Algorithm::Diff and LCS::BV. LCS::BV is a little faster than Algorithm::Diff::XS in some cases.
Returning AoA is the most convenient for further processing. Will see, how bitmaps or packed perform on e.g. a Center Star Alignment using the LCS as input.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Faster creation of Arrays in XS?
by BrowserUk (Patriarch) on Jun 22, 2015 at 15:00 UTC | |
See Tuning Algorithm::Diff The problem with that benchmark is it only tests the call to the functions; not the subsequent accessing of the returned information. Accessing the bits from Pure Perl will kill the performance stony dead. Update: Added another few tests, including a bitvector version to the benchmark:
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.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!
| [reply] [d/l] |
by wollmers (Scribe) on Jun 23, 2015 at 07:19 UTC | |
BrowserUK: Thanks for the code examples and ideas. For me this is also a nice example of using Inline (the first time for me). I only had to change unsigned __int64 bits in code>diffBits</code> which my toolchain (Mac OSX) can not handle. The problem with that benchmark is it only tests the call to the functions; not the subsequent accessing of the returned information. The benchmarks of diff implementations mentioned in my blog return all the same: a reference to an AoA. If they return the same, I need not care about subsequent accessing. The exception is String::Similarity with (fast) strings as input, without constructing the aligment, and returning only one number. It's only there for showing an upper limit | [reply] [d/l] |
by BrowserUk (Patriarch) on Jun 23, 2015 at 11:39 UTC | |
For me this is also a nice example of using Inline (the first time for me). YW. Tip. If you keep the number of line preceding the I::C code to 4 (as in my examples), then you'll find that the line numbers produced by the compiler in warnings and errors match those in the .pl file exactly; which is infinitely more convenient than have to backtrack them from generated .c file via the generated .xs file, both of which get stuck away in some obscure directory. 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.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!
| [reply] |