PLEASE NOTE: this server, secure.csse.uwa.edu.au, will be unavailable on WEDNESDAY 7th December, from 1pm until 4pm.
Web-based programs, such as csmarks, cssubmit, and the help fora, will all be unavailable.
  It's UWAweek 49

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 the 3 articles in this topic
Showing 3 of 564 articles.
Currently 2 other people reading this forum.


 UWA week 17 (1st semester, week 8) ↓
SVG not supported

Login to reply

👍?
helpful
8:20pm Tue 26th Apr, Marc E.

Hi! I have read the past thread regarding the program speed, so far my Part1 is doing good (not the 0.2 second that Michael has but my time is still ok). However, I am having problems with Part 2 in terms of speed. I have tried everything to reduce the runtime. I am using a for loop to extract the top common word in each file (all 10 of them) and that's took me 22 seconds. Using awk, I managed to get it down to 15 seconds but that is still while using a for loop. I am not sure what else to do to get this down. I made sure that I am not using sub-shells as well to be more efficient. Combining awk and sed is slower than awk and tr for me, so I am not sure what else to do. I even tried using perl (but I suppose that it is beyond the scope of this unit). On another note, why is running loops so inefficient in bash? Running exactly the same logic in R or python for the same task is giving me about 0.12 seconds, against 15seconds in bash.


SVG not supported

Login to reply

👍?
helpful
8:40pm Tue 26th Apr, Michael W.

Hi Marc, The second part will inevitably be slower. In the first part you are traversing one file of ~2,500 lines. For the second part you are traversing multiple, say 10, files with a total of 95,000 lines of text. Please don't get too fixated on speed. In truth, I have written the marking code so that each test runs to a time limit (just in case a program goes into an infinite loop). I will be setting generous margins on top of what my system takes, on the basis that a fair portion of the class will be happy to get something working and I don't want to mess with that. There is a premium on passing tests (80% you'll) recall, versus 20% for style, of which runtime, if it matters at all, will be a small component. Cheers MichaelW


SVG not supported

Login to reply

👍?
helpful
8:46pm Tue 26th Apr, Marc E.

Hi Michael, That's a relief, thank you for your clarification. I'll focus on the other aspects of my program instead. Cheers, Marc

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