Giter Club home page Giter Club logo

Comments (23)

strk avatar strk commented on May 22, 2024

NOTE: 0.2.0 works fine, 0.2.2 has the problem.

from node-csv.

strk avatar strk commented on May 22, 2024

0.2.1 also has the problem.

from node-csv.

wdavidw avatar wdavidw commented on May 22, 2024

I have isolated the problem, fix coming in a second, thanks

from node-csv.

strk avatar strk commented on May 22, 2024

\o/ !
For the record, here's the code I'm migrating:
https://github.com/Vizzuality/CartoDB-SQL-API/blob/rs120/app/controllers/app.js#L395

from node-csv.

wdavidw avatar wdavidw commented on May 22, 2024

I just uploaded a new version, probleme is, the csv.to.stream option now use pipe and i wasn't passing the options.

Change and tests illustrating the issue is here: bfbe69e

Note concerning your code, the "end" option is true by default, this follow the node conventions.

from node-csv.

wdavidw avatar wdavidw commented on May 22, 2024

I'm closing it, feel free to re-open the issue if still present

from node-csv.

strk avatar strk commented on May 22, 2024

Uhm, still doesn't work, but I cannot reopen.

from node-csv.

strk avatar strk commented on May 22, 2024

it only happens when the input is big (I guess > 81920, thus sent in chunks)

from node-csv.

strk avatar strk commented on May 22, 2024

you can try yourself cloning CartoDB-SQL-API and running make && make check
The latter (make check) would fail if you use current csv version

from node-csv.

strk avatar strk commented on May 22, 2024

NOTE: you'll need to change toStream to to.stream when switching to current csv

from node-csv.

wdavidw avatar wdavidw commented on May 22, 2024

I just run your test, 13 are failing but none of those seems to be csv related, here are my modification:

        csv()
          .from.array(data.rows)
          .to.stream(res, {columns: columns, header: true, lineBreaks: "windows"});

from node-csv.

strk avatar strk commented on May 22, 2024

I get a single failure here:

  1. app.test CSV format, bigger than 81920 bytes:
    The error is a timeout (2000ms exceeded)
    Same modifications.
    Can it be performance degraded incredibly between 0.0.13 and 0.2.2 ?

from node-csv.

wdavidw avatar wdavidw commented on May 22, 2024

Not that i'm aware of. The parsing algorithm is the same, and on my machine, the test passed. I'll try to make a small test to compare speeds with an older version. Could u prepare a loop that create the same input as the one in your test (you're using from.array(..) right?)

from node-csv.

strk avatar strk commented on May 22, 2024

The input is an array of 81920 elements of value "0" and name "fname"
in this form:

  [ { fname: 0 },
    ....
    { fname: 0 } ]

Here, is you want something quick to copy&paste:

  makeInput = function(num,name,val) {
    var ret = [];
    for (var i=0; i<num; ++i) ret.push({fname:val});
    return ret;
  };

The testcase input would be produced by:

var input = makeInput(81920, 'fname', 0);

from node-csv.

strk avatar strk commented on May 22, 2024

NOTE: I didn't check the output either... worth doing for sure

from node-csv.

wdavidw avatar wdavidw commented on May 22, 2024

ok, i'll look at it in 20mn, doing some speed/memory comparaison can't harm

from node-csv.

wdavidw avatar wdavidw commented on May 22, 2024

The parser was twice slower than versions 0.0.x due to the usage of bind that prevend v8 from optimisation the transform function. If interested, the responsible is here: 1728f5e

the following is now 5x times faster:

    csv()
    .from.array(data)
    .to.stream(out)

a new version 0.2.4 is available in npm

from node-csv.

strk avatar strk commented on May 22, 2024

Great !
I tried upgrading to 0.2.4 but:

Error: Cannot find module './stringifier'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/home/src/node/apps/CartoDB-SQL-API/CartoDB-SQL-API/node_modules/csv/lib/csv.js:146:15)

Missing dependency in package.json ?

from node-csv.

wdavidw avatar wdavidw commented on May 22, 2024

some lower/uper case issue, give me a second

from node-csv.

wdavidw avatar wdavidw commented on May 22, 2024

ok, could u try again downloading 0.2.4

from node-csv.

strk avatar strk commented on May 22, 2024

I had to clean the npm cache to really get the new version, anyway now the "stringifier" problem is gone, but I still have a timeout for that test :/

from node-csv.

wdavidw avatar wdavidw commented on May 22, 2024

is your code with the timeout on github? if not could you push it on a branch so i can test

from node-csv.

strk avatar strk commented on May 22, 2024

I've just pushed it to the "develop" branch of CartoDB-SQL-API, after verifying that raising the timeout of mocha invocation helps at completing the test run. I can also handle to get the tests succeed with default timeout (2 seconds) but is unstable (edge-condition).

Never had the same problem with 0.0.13 so I think there still is a performance degradation.

from node-csv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.