Absolute fastest way to save and read data from text file (or binary file...)

Discussion in 'AutoCAD' started by James Maeding, Jul 17, 2003.

  1. James Maeding

    Mark Propst Guest

    Just to see if i understand this then, (just read the help on exporting
    functions - don't really understand it or why even to do it) it all seemed
    to relate to c++ only in the msdn)
    if i just create a dll with subs, properties etc, nothing is exported and I
    can call it from lisp with invoke method?
    but if i create a .def file or use the __declspec(dllexport) keyword then
    that is what Exports functions and then they cannot be used by lisp?
    it seemed like it created smaller apps without the bloat typical of a vb
    creation?
    you should be used to that by now from me! "-)))

    sorry, I just thought i heard that vb could call an exported function. and I
    know that in autocad you have to call vb or vba with lisp to run it, so I
    thought that might be an indirect way to call the exported
    function.(obviously I have no idea what an exported function is as opposed
    to a non-exported function. Reading the help about how to export them
    didn't give me any insight into Why I would want to export them or not
    export them. I have no idea what the exportation would do or not do for me
    in any given case. If I can call a dll and use it's functions why do I care
    what kind of a function it is???? maybe some kind of compiler optimization
    issues??/?
    I don't really mean to be wasting your time on this, since it's so far over
    my head any way, it just sounded interesting and i'm always hungry to learn
    new stuff (which is not always to my advantage - much time wasted on stuff
    I'll never be smart enough to use anyway)
    right you are! My bad!!! it was my stupid string concatenating that was
    slow.
    i read 1094 files in way less than a second (don't have a timer set up yet)
    even collecting them into a collection that ended up with 500000 + entries
    seemed to take no time at all.

    well, considering the author....you probably could! :')

    Thanks again and sorry for wasting your time on this
    Mark
     
    Mark Propst, Jul 18, 2003
    #21
  2. To Ann Brown,
    It would be a favor if you could move these items to the thred with the same title a couple up and delete this thread.
    They were supposed to be together.
    thx

    Byron Blattel <byronatcadwerxdotnet>
    |>michael puckett wrote:
    |>> Write a DLL using PowerBASIC ( http://www.powerbasic.com/products/pbdll32 ).
    |>> You can write an optimized I/O routine that will blow the doors off VB (
    |>> approaching optimized C performance ) and yet you can use most of your
    |>> existing BASIC knowledge.
    |>
    |>Michael,
    |>
    |>Did you give up on C++?
    |>
    |>Just interested ;)

    James Maeding
    Civil Engineer/Programmer
     
    James Maeding, Jul 18, 2003
    #22
  3. James Maeding

    Anne Brown Guest

    James -

    Netscape shows these messages all threaded together. I don't have
    a "glue" command like we used to on Compuserve. I'll take a look
    atthe messages in HTTP and see what I can do but no promises.
    Occasionally trying to "glue" makes messages disappear.

    Anne
     
    Anne Brown, Jul 18, 2003
    #23
  4. James Maeding

    Mark Propst Guest

    they appear to be in the same thread to me

    same title a couple up and delete this thread.

    so did you get a solution to your problem?
    one thought was, you're not creating your fso 300 times in a loop are you?
    couldn't tell from your snippet

    I tried with vb and it read 1094 files and put their contents into a
    collection in less than a second.
    I bet it's not the reading that's slow, but maybe the cons?

    heres a test with straight lisp
    there's a few user defined funcs in here but you probably have equivalents -
    if not let me know
    (defun test1()
    (timein)
    (setq path "C:\\0\\0code\\lisp\\master")
    (setq numfiles 0 numlines 0)
    (setq flst(getfiles path "*lsp" nil))

    (foreach f flst
    (incvar 'numfiles)
    (setq fhndl(open (strcat path "\\" f) "r"))
    (while(read-line fhndl)
    (incvar'numlines)
    )
    (close fhndl)
    (setq fhndl nil)
    )
    (princ(strcat "\n" (itoa numfiles) " Files Read"))
    (princ(strcat "\n" (itoa numlines) " Lines Read"))
    (timeout)
    (princ)
    )
    ;result in vlisp console
    _$ (test)

    1094 Files Read
    150369 Lines Read
    "That took 4.92 seconds "
    _$

    granted, still not lightning fast...

    then with cons thrown in
    (defun test2()
    (timein)
    (setq path "C:\\0\\0code\\lisp\\master")
    (setq numfiles 0 numlines 0 biglst nil this nil)
    (setq flst(getfiles path "*lsp" nil))

    (foreach f flst
    (incvar 'numfiles)
    (setq fhndl(open (strcat path "\\" f) "r"))
    (while
    (setq this(read-line fhndl))
    (setq biglst(cons this biglst))
    (incvar'numlines)
    )
    (close fhndl)
    (setq fhndl nil)
    )
    (princ(strcat "\n" (itoa numfiles) " Files Read"))
    (princ(strcat "\n" (itoa numlines) " Lines Read"))
    (princ(strcat "\nLength biglst" (itoa (length biglst))))
    (timeout)
    (princ)
    )
    _$ (test2)

    1094 Files Read
    150369 Lines Read
    Length biglst150369
    "That took 5.91 seconds "
    _$
    even slower still, naturally, but that's still 0.006 seconds per file, isn't
    it?

    was there a reason you're using the fso? I would think having lisp talk to
    active x would put one more step in the process compared to just plain lisp,
    but I don't really know?
    I'm definitely interested in the same issue though, time of reading text
    files and strings and comparing them or searching for target strings.

    hope you're having some success
    Mark
     
    Mark Propst, Jul 18, 2003
    #24
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.