Thank you Andreas, finally I can see a real benchmark on my laptop:

python3 -m timeit -s "from django.utils.dateparse import parse_datetime"
"print(parse_datetime('2018-04-01 09:07:04'))"
100000 loops, best of 3: 11.1 usec per loop

python3 -m timeit -s "import datetime"
"print(datetime.datetime.strptime('2019-02-03T17:27:58.645194',
'%Y-%m-%dT%H:%M:%S.%f'))"
100000 loops, best of 3: 18 usec per loop

python3 -m timeit -s   "import sys, os; sys.path.append(os.getcwd()); from
datetime_heuristic_parser import datetime_heuristic_parser"
"print(datetime_heuristic_parser('04/12/2018 09:7:4'))"
10000 loops, best of 3: 25.4 usec per loop





Il giorno lun 4 feb 2019 alle ore 15:18 Andreas Pelme <andr...@pelme.se> ha
scritto:

> On 4 Feb 2019, at 15:04, Giuseppe De Marco <giuseppe.dema...@unical.it>
> wrote:
>
>
> python3 -m timeit -s   "import sys, os; sys.path.append(os.getcwd()); from
> datetime_heuristic_parser import datetime_heuristic_parser;
> print(datetime_heuristic_parser('04/12/2018 09:7:4Z'))"
>
>
> That command is not correct. timeit -s takes two arguments: setup code and
> benchmark code. This command just executes the setup code and does not run
> any code at all for the actual benchmark.
>
> The correct command would be something like this (I did not run this
> command myself but you get the idea):
> python3 -m timeit -s   "import sys, os; sys.path.append(os.getcwd()); from
> datetime_heuristic_parser import datetime_heuristic_parser”
> "datetime_heuristic_parser('04/12/2018 09:7:4Z’)"
>
> Cheers,
> Andreas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/0DCE461D-F01F-48C6-B5DD-CBCEFE2895FC%40pelme.se
> <https://groups.google.com/d/msgid/django-developers/0DCE461D-F01F-48C6-B5DD-CBCEFE2895FC%40pelme.se?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
____________________
Dott. Giuseppe De Marco
CENTRO ICT DI ATENEO
University of Calabria
87036 Rende (CS) - Italy
Phone: +39 0984 496945
e-mail: giuseppe.dema...@unical.it

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CABms%2BYrSBwzpS38yf_tinGfPDnrBr8cF6VM396%3DEO9ALXCpwaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to