Hi,

And most importantly thanks for this contribution, I think
it's a very nice one and can easily replace any temp tables
created on disk. I'll now go and convert my app to use it.

the primary idea was more a toy I/O driver than the really useful addition to harbour. Linux users can reach a similar effect by storing files at /dev/shm. Disk buffers also makes a disk to be a little similar (by speed) to memory. I still wanted to test disk overhead on local drives, so, I've wrote this I/O driver. Test (source code is presented below) execution times are:
Mem I/O:
  DBAPPEND       13203
  INDEX        8375
  DBEVAL        6890
File I/O:
  DBAPPEND       24563
  INDEX        9266
  DBEVAL       11484

But now I'm thinking about including this I/O driver into one of the projects. We have about a 1 million records in database and report generation is too slow in network environment (in local environment speed is acceptable). I'm thinking about copying the whole remote file (well, about 100MB...) to memory file system, and generating report from memory.


Regards,
Mindaugas


REQUEST HB_IODMEM

#define COUNT   2000000

PROC main()
LOCAL nI, nJ, nT
FIELD F1, F2

  ? "Mem I/O:"
DBCREATE("mem:test", {{"F1", "C", 64, 0}, {"F2", "N", 9, 0}},, .T., "memtest")
  nT := HB_MILLISECONDS()
  FOR nI := 1 TO COUNT
     DBAPPEND()
     F2 := HB_RANDOM() * 1000000
     F1 := "Blah, blah, blah..." + STR(RECNO()) + " " + STR(F2)
  NEXT
  ? "  DBAPPEND ", HB_MILLISECONDS() - nT
  nT := HB_MILLISECONDS()
  INDEX ON F2 TAG F2
  ? "  INDEX ", HB_MILLISECONDS() - nT
  nT := HB_MILLISECONDS()
  nJ := 0
  DBEVAL({|| nJ += F2})
  ? "  DBEVAL ", HB_MILLISECONDS() - nT
  DBCLOSEALL()
  DBDROP("mem:test")

  ? "File I/O:"
DBCREATE("test", {{"F1", "C", 64, 0}, {"F2", "N", 9, 0}},, .T., "memtest")
  nT := HB_MILLISECONDS()
  FOR nI := 1 TO COUNT
     DBAPPEND()
     F2 := HB_RANDOM() * 1000000
     F1 := "Blah, blah, blah..." + STR(RECNO()) + " " + STR(F2)
  NEXT
  ? "  DBAPPEND ", HB_MILLISECONDS() - nT
  nT := HB_MILLISECONDS()
  INDEX ON F2 TAG F2
  ? "  INDEX ", HB_MILLISECONDS() - nT
  nT := HB_MILLISECONDS()
  nJ := 0
  DBEVAL({|| nJ += F2})
  ? "  DBEVAL ", HB_MILLISECONDS() - nT
  DBCLOSEALL()
  DBDROP("test")
RETURN

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to