Speeding Up Code
The latest heavy project at $work makes me miss C a bit. There's a lot of Moose objects, KiokuDB, MooseX::Getopt (which is evidently much lighter than I thought) and more. To display all the entries I have in a KiokuDB SQLite database, it takes roughly a second and a half!
Profiling with NYTProf 3.0 (FTW!) shows that Moose takes the most. I don't want to use Mouse for various reasons which I won't go into. Moose::Compile, MooseX::Antlers, nothing near production yet (but I'm keepings my fingers crossed). I tried to rewrite the MooseX::Getopt part and use Getopt::Long manually, but it only speed it up by 30ms. Oh, and yes, everything is immutable. Requiring KiokuDB::Navigator only in the part that loads the navigator gained me 300ms.
I can start rewriting everything with clean Perl objects. It could take a while, but I could get it done. However, that would be losing all the fun and power I get from Moose. Instead I thought of a different idea.
Since I want to integrate this with another database backend (which might be on a remote server) anyway, the speed will slow down a lot because even a small request for display the local database entries would make a trip to the remote database, so even without Moose, the penalty would be great.
I thought of putting everything in a daemon, which would compile and load all the code. The client would be simple code which just asks the daemon to run things. The runtime penalty can't be too big, so I think it would work out. The daemon could fetch the remote data once in a while or per command. That's about it.
I might try to rewrite it without Moose and see the differences. That would be interesting to note in the lectures I'll be giving on Moose next week.