On Tue, Feb 09, 2010 at 03:04:23PM +0000, Tim Bunce wrote:
> I'd guess you'd see a significant gain in performance by changing
> TIME_BLOCK & TIME_LINE handling along these lines...
>
> - Move the output_tag_int(out, NYTP_TAG_TIME_BLOCK... code
> out of DB_stmt into a new function.
> - Check the return value of the TIME_BLOCK & TIME_LINE handlers.
> - If false then call the new function using the (possibly now modified)
> cb_args[i] values.
>
> That'll save you half a bazillion $out->write & $out->output_int method
> calls. The code would just edit $_[4] and return;
I had assumed that I was going to implement your earlier plan (first):
On Fri, Dec 18, 2009 at 12:34:56PM +0000, Tim Bunce wrote:
> I was thinking along vagely similar lines last night.
>
> Currently the "NYTP_*" i/o functions are currently all very low-level:
>
> NYTP_tell(NYTP_file file) {
> NYTP_type_of_offset(NYTP_file file) {
> NYTP_start_deflate(NYTP_file file) {
> NYTP_start_inflate(NYTP_file file) {
> NYTP_open(const char *name, const char *mode) {
> NYTP_gets(NYTP_file ifile, char *buffer, unsigned int len) {
> NYTP_read_unchecked(NYTP_file ifile, void *buffer, size_t len) {
> NYTP_read(NYTP_file ifile, void *buffer, size_t len, const char *what) {
> NYTP_write(NYTP_file ofile, const void *buffer, size_t len) {
> NYTP_printf(NYTP_file ofile, const char *format, ...) {
> NYTP_flush(NYTP_file file) {
> NYTP_eof(NYTP_file ifile) {
> NYTP_fstrerror(NYTP_file file) {
> NYTP_close(NYTP_file file, int discard) {
>
> we could add output_int(), output_nv() etc. but I think a better
> approach would be to create a new layer of higher-level functions:
>
> nytp_write_stmt_time(NYTP_file ofile, elapsed, fid, line, block_line,
> sub_line);
> nytp_write_new_fid(NYTP_file ofile, id, eval_fid, eval_line_num, ...)
> ...
>
> (output_int(), output_nv() etc. could be made private to that 'library'.)
>
> That would give us encapsulation of the file format. nytprofmerge could
> be significantly faster with an XS interface to those functions.
I'm just not yet sure about the C source file names. I assume that the file
handle XS stays in Devel::NYTProf::FileHandle, so it's a name for the low(er)
level IO code, such as output_int() and friends.
Nicholas Clark
--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.
Group hosted at: http://groups.google.com/group/develnytprof-dev
Project hosted at: http://perl-devel-nytprof.googlecode.com
CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf
To post, email: [email protected]
To unsubscribe, email: [email protected]