File: setup_new_drawing.py

package info (click to toggle)
ezdxf 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104,528 kB
  • sloc: python: 182,341; makefile: 116; lisp: 20; ansic: 4
file content (27 lines) | stat: -rw-r--r-- 507 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) 2019-2022 Manfred Moitzi
# License: MIT License
from timeit import Timer
import ezdxf

SETUP = """
from __main__ import setup_drawing
"""


def setup_drawing():
    doc = ezdxf.new()
    _ = doc.dxfversion


def main(count):
    t = Timer("setup_drawing()", SETUP)
    time2 = t.timeit(count)
    print_result(time2, f"setting up {count} new DXF documents")


def print_result(time, text):
    print(f"Profiling: {text} takes {time:.2f} seconds")


if __name__ == "__main__":
    main(1000)