Subscribe to Grim's Projects        RSS Feed
-----

Vexiest Version, Verily

Icon Leave Comment
While I'd love to do everything in the style of V for Vendetta that isn't what's happening here. Namely, I'm just continuing my rant on the current experimental upgrades to Mimesis. So, continuing from last time I said I was seeking to do three things in the future (which arrived more immediately than I suspected originally):

One -> Use array_walk in place of array_map. Can't do it because array_walk passes two parameters as opposed to a single parameter and the serialize function complains accordingly about having two parameters passed to it.

Two -> Leave Mimesis::renameRow out and/or revise it. Its appearing that I will be in fact leaving it out.

Three-> Analyze the limits of fread and fwrite operations. Ehh... fact is I'm comfortable with a limit of 2^31 - 1 bytes for files. We're talking 2 gigs of data. Odds are the script wouldn't even finish executing if it had to work that amount of data.

More improvements? Why yes indeedy. Here's what I've done:

I've replaced many substr and substr_replace operations by directly accessing the characters of a string using the string[] notation. Since you can access characters in a string much like the values in an array, the use of pack/unpack has proved further useful by allowing me to access byte values directly.

Before I was utilizing lots of reset(unpack('N', substr(...))) operations which have been replaced with the ord() function, bitwise operations, string[] access, and arithmetic. I believe this is probably faster than substr, unpack, and reset working in unison though I haven't benchmarked it.

Replaced a couple of packs with direct values such as "\x00" and the like.

In the places where substr_replace was used I simply used the string[] index and assigned it the value of whatever needed to be packed. I figure this is quicker than a function call.

I don't entirely recall with a great degree of certainty, but I may have fixed a bug in the deleteRow method, and for sure I fixed two in the getRow method. In fact the getRow method was malfunctioning entirely. Carelessness with code changes will do that to you.

Anyhow, I'm very satisfied with the changes up to this point and it seems that its working better than ever as I'm using the Mimesis site to test it (after a couple of hurdles and bumps along the way). Shouldn't be too long now before I release it to the public.

0 Comments On This Entry