2009/8/14 Henrik Johansen <henrik.s.johansen@veloxit.no>
I added a version to the issue which is almost 2x faster (for large ByteArrays at least). I'm not sure if the needs of DBX are such that the performance increase can justify the added uglyness (using to:do: instead of do: ), but it'd be nice if you would have a look.
Henry: Thanks for your feedback and work! I tried both solutions. The one I posted, with your benchmark give me 34734. However, with your version, I have 29675. best, Mariano
Cheers, Henry
On Aug 13, 2009, at 3:23 08PM, Mariano Martinez Peck wrote:
Ok. I opened the ticket: http://code.google.com/p/pharo/issues/detail?id=1067
I replaced _ to := and take into considerations the henrik suggestions.
Best,
Mariano
On Thu, Aug 13, 2009 at 9:47 AM, Henrik Johansen < henrik.s.johansen@veloxit.no> wrote:
Please also use (String new: (self size * 2)) writeStream instead of '' writeStream. In this case it won't lead to any noticeable performance increases, but it's good practice anyways :)
I'd also argue the expected returnvalue of "hex" might not be clear as something like "asHexString" when applied to a collection (hex previously only implemented on single values), but that's a minor issue.
When looking around, I also noticed WriteStream nextPut: does an unnecessary check for ByteStrings which is pretty ugly (plus, it decreases nextPut: performance for all ByteString writeStreams), filed as Issue 1065.
Cheers, Henry
Issue 1065 On Aug 13, 2009, at 10:32 19AM, Stéphane Ducasse wrote:
add a nice method comment and a couple of tests!
Stef
On Aug 13, 2009, at 1:26 AM, Mariano Martinez Peck wrote:
Hi folks: Me and the rest of the team is developing SqueakDBX which is a driver to talk with major databases. However, I think the most persistence alternatives pharo has, the best. There is no better solution for every escenario. So, I am also trying to get the PostgreSQL native driver to work in Pharo. This package depends on Cryptography because of MD5. I know that there were added to Pharo packages like System-Hashing-core, System-Hashing-SHA1 and System- Hashing-MD5. However, the driver doesn't work yet. But adding this single method:
ByteArray>>hex | stream | stream _ '' writeStream. self do: [ :each | stream nextPut: ('0123456789ABCDEF' at: each // 16 + 1); nextPut: ('0123456789ABCDEF' at: each \\ 16 + 1)]. ^ stream contents
The driver works like a charm in Pharo without needing Cryptography package. As far as I remember there were no MIT problem with this package. Because of this those packages ( System-Hashing-core, System-Hashing-SHA1 and System-Hashing-MD5) were integrated in Pharo.
So, can I add it?
Thanks
Mariano _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project