in reply to Preferred language for scheduler assignment?

This problem would be straightforward in Perl. Whether it meets your requirements for efficiency depends on the criteria.

If the code just needs to be efficient (as in not wasteful), then Perl is probably better than C, etc. If it needs to run as fast as possible, then C might be your best bet. Considering that most of the time is spent executing other programs, I think it would be hard to tell the difference between comparable C and Perl implementations.

I would suggest looking at Time::HiRes (or Time::AutoRes); system or `` (backquotes) or qx//; reading and writing files (the <> operator, and print/printf); split and/or regular expressions (match operator m// or just //).

But if you're more comfortable in C than in Perl, C will be less hassle for you in the short term. If you have some time to learn, Use Perl!.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re^2: Preferred language for scheduler assignment?
by superfrink (Curate) on Nov 20, 2004 at 08:33 UTC
    But if you're more comfortable in C than in Perl, C will be less hassle for you in the short term. If you have some time to learn, Use Perl!.
    I have to second that. I like perl, I really do, but when I was in school I tried to use a language I did not know and it cost me. This comment is not about a language war but rather it is about using your time efficiently and meeting as many of your goals as you can.

    It was an intro compiler course. The first assignment was a simple translator and we could use one of five languages (and lex libraries). I was most comfortable with C so I wrote about 1500 lines of code over a two day weekend. gdb was really handy for tracking through pointers in trees. I got a good grade on it.

    Now the recommended language was python. I had never used python but the instructor recommeneded it and so did other students who knew it. I saw some of their programs were shorter than mine and I had spent a lot of time just writing linked list and tree code. So I tried python for the second program in the course.

    The short version is I was busy with a paying job and school and the local undergrad club and now I was trying to write a compiler (which was new to me anyway) in a language I had never even written "hello world" in.

    My assignment was late by a few days and was never completed. Up to that point I had used C, C++, Java, I don't know how many Assembly languages, LISP, Prolog and I'm sure a couple more but for the life of that compiler assignment I couldn't get python figured out in the time I had. (I still got a B-something in the course.)

    My advice is don't take on too much. This course sounds like a Real Time Systems course. It's not on Perl or languages so focus your effort on the course content.

    Afterwards most people are not going to notice that you learned a new language in a course and you can always learn it on your own time. Employers who ask to see your grades will likely notice if you did not pass a course and maybe you would prefer they see a higher grade. That said if you are asking this question you are likely bright and enjoy learning and will probably do just fine but my advice still remains as: don't complicate your assignments (or work projects) any more than you have to.
      Hear! Hear! Well said.

      Just a comment on this:

      Employers who ask to see your grades will likely notice if you did not pass a course and maybe you would prefer they see a higher grade.
      A plum employer would be more interested in why you didn't succeed, what lessons you learned from the experience, and what you would do differently given the chance. You shouldn't be afraid of failing, but afraid of not learning anything in the process, and afraid of not trying again.

      Good judgement comes from experience. Experience comes from bad judgement.

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of