Speed of loading text file

Discussion in 'AutoCAD' started by kam--mik, Dec 2, 2004.

  1. kam--mik

    kam--mik Guest

    I'm trying to import a large text file using LISP. I found that the
    performance is not satisfatory. I opened up the window task manager and
    found out AutoCAD is loading the text file at 4 KB per second. If I have a
    several MB file, it will be very slow.

    It is also your experience? How did you solve it?
     
    kam--mik, Dec 2, 2004
    #1
  2. kam--mik

    Shane-W Guest

    If you are using read-line, perhaps you can use lisp/script to load it as rtext, explode it grab (assoc 1 ) from the exploded rtext (will be mtext) and then erase the m text.

    Didnt try it with a 4meg file but it works, just a thought...
     
    Shane-W, Dec 2, 2004
    #2
  3. kam--mik

    petervose Guest

    I tried this using the following routine on a 1.2MB Text file (abc.txt), and it took 0.161seconds.

    (defun rf ( / of1 timepoint1 timepoint2 st_time)
    (setq timepoint1 (getvar "date"))
    (setq mylist nil)
    (setq of1 (open "c:\\temp\\abc.txt" "r"))
    (while (setq nl_of1 (read-line of1))
    (setq mylist (cons nl_of1 mylist))
    )
    (close of1)
    (setq timepoint2 (getvar "date"))
    (setq st_time (* 86400.0 (- timepoint2 timepoint1)))
    (princ (strcat "\n File loaded in " (rtos st_time) " Seconds"))
    (princ)
    )
     
    petervose, Dec 2, 2004
    #3
  4. kam--mik

    ECCAD Guest

    If the file you are reading is on a Network, this will operate
    (very slow). Move / Copy the file local, then try it again.
    Bob
     
    ECCAD, Dec 2, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.