Comments (23)
NOTE: 0.2.0 works fine, 0.2.2 has the problem.
from node-csv.
0.2.1 also has the problem.
from node-csv.
I have isolated the problem, fix coming in a second, thanks
from node-csv.
\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.
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.
I'm closing it, feel free to re-open the issue if still present
from node-csv.
Uhm, still doesn't work, but I cannot reopen.
from node-csv.
it only happens when the input is big (I guess > 81920, thus sent in chunks)
from node-csv.
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.
NOTE: you'll need to change toStream
to to.stream
when switching to current csv
from node-csv.
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.
I get a single failure here:
- 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.
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.
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.
NOTE: I didn't check the output either... worth doing for sure
from node-csv.
ok, i'll look at it in 20mn, doing some speed/memory comparaison can't harm
from node-csv.
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.
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.
some lower/uper case issue, give me a second
from node-csv.
ok, could u try again downloading 0.2.4
from node-csv.
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.
is your code with the timeout on github? if not could you push it on a branch so i can test
from node-csv.
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)
- Link to Pipe recipe in docs is broken. HOT 2
- CSV Parsing fail when extra cell with no column HOT 1
- Function parse returns "any" - Could it be made generic? HOT 4
- csv-parse stream will process the whole buffer even with back pressure. HOT 6
- Error message when using vite
- Option `to` and `to_line` results in `ERR_STREAM_PREMATURE_CLOSE` HOT 4
- When `bom` and `skipRecordsWithError` skip event is not raised for skipped records HOT 7
- How can I convert json object with array to csv? HOT 1
- Date parse bug HOT 2
- Parse dot notation columns into nested objects HOT 4
- CSV Parse breaks on comment characters that are also in rows HOT 4
- csv-parse fails to parse very large CSV files
- User-defined value generation HOT 5
- support headers as comment HOT 3
- Support parsing of quote characters within quotes HOT 2
- Ignore comment lines for the from_line value
- bug: Fatal JavaScript invalid size error HOT 1
- Error Lines Property Should Return All Lines of error HOT 1
- Taking too much energy and patience to navigate and understand the docs site HOT 1
- Browser Streaming Support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-csv.