Thank you for the support guys.
The weird statements surrounding the operations with SQL were created just for
benchmarking's sake with Python.
Anyways, optimizing the handlers of the CSV, due it is not that big, brought no
real gain of performance. Comparing the elapsed time of Nim and Python, even
so, the second is still faster (around 20%).
So, I decided to make some modifications in both codes, as per the snipped
below, where I removed the SQL statement related to the "select count(*)".
For my surprise, now, both codes are running at the same speed !!
I will profile both asap... however, one doubt: - What is the best way to
profile a code in Nim ? Can you pls provide me some directions ?
Cheers,
while p.readRow():
for col in items(p.headers):
(lookup_id, lookup_name_source) = p.rowEntry(col).split('|')[0..1]
lookup_name_source = lookup_name_source.toUpperAscii
counter = 1
for r in stingraydb.fastRows(sql"select cnpj, company from
tb_reference_pj where company match ?", (lookup_name_source)):
if counter > 20:
echo r[1]
break
counter += 1
if len(r[1]) <= 80:
company = r[1]
if lookup_name_source == company:
echo company