It's UWAweek 48

help2003/help4407

This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 564 articles.
Currently no other people reading this forum.


 UWA week 16 (1st semester, non-teaching week) ↓
SVG not supported

Login to reply

👍?
helpful
6:43pm Tue 19th Apr, Ryan B.

ANONYMOUS wrote:
> That's surprising, because I did not nest any for loops, I simply iterate over each row of the csv file once and i'm taking 20-30 seconds. Is a file size of 2033 lines considered "colossal" or should I be concerned?
To answer the second question, first: 2033 is quite small. For example, the Alice in Wonderland file we have been working with in the labs is almost 4000 lines, and all our scripts take very little time to complete. What I suspect you are doing is redundant operations; by this, I mean doing unnecessary processing for every line first. If I am passing in a country as an argument, for example, I should only be concerned with doing further 'searching/sorting' on the subset of data to do with that country (max 10-15 lines/country). I suspect you may be doing all the computation for each country upfront by check if each row is the right country, and then compare the number in that row to a `max` variable somewhere? I could be wrong, this is a pure guess. At any rate, a line-by-line approach is probably unnecessary for this particular question. I'd recommend taking a step back, and perhaps looking over some of the more recent material on regular expressions with `grep` and `sed`. Remember that we have been processing multiple rows in a csv file in various ways (using `sort`, `cut` etc.) without having to loop through them line-by-line in the labs, so perhaps review that material, too. Hope this helps! Ryan (lab guy).

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy