On So, 12 Nov 2017, Tim Chase wrote:

> Taking on the challenge listed here
> 
> https://dev.to/jorinvo/csv-challenge-1al
> 
> it provides a .json file link to mung into date-named files (never
> mind that these happen to all be the same date), I came up with this
> vim solution:
> 
> :g/.*name":"\([^"]*\)".*card":"\([^"]*\)".*/let
> s=substitute(getline('.'), '.*stamp":"\(\d\+\)-\(\d\+\)-\(\d\+\).*',
> '\1\2\3','').'.txt'|s//\1,\2/|exec ".w!>>".s
> 
> which works.  But for some reason, it is *painfully* slow on my
> machine.  The basic intent is that it identifies rows with a (fake)
> credit-card number, snapshots the YYYYMMMDD.txt filename, then turns
> the row into a CSV entry ("name, CC"), and writes (appending) that one
> line into the output filename.
> 
> The whole thing should happen in a blink. Maybe a second at worst.
> But this was walk-away-do-something-and-come-back slow.
> 
> If I change the "exec" to an "echo", it's as fast as I expect.
> 
> Any idea what might be making the exec so slow?

No idea and I bet running it under gdb will make it even slower :(

Nevertheless can you try this with a debug Vim and hit <Ctrl>-C 

This should give us a clue, which codepath is slow. Please try this 
several times, so we are sure, that we hit the slow codepath.

Of course, easier would be to provide a correct profiling information :)

Christian
-- 
Es gibt erfülltes Leben, trotz vieler unerfüllter Wünsche.
                -- Dietrich Bonhoeffer

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to