Meta tags:
description= Replace the hand-written dialect_new with an Argument Clinic + vectorcall. Move _csv_Dialect___replace___impl() from calling dialect_new() to dialect_new_helper() to avoid temporary tuple.
Error message for too many arguments is now TypeError: Dialect() takes at most 9 arguments (N given) instead of TypeError: function takes at most 9 arguments (N given).
Didn t change _csv.reader / _csv.writer whose **fmtparams is not supported by AC vectorcall before #162465 is merged.
Benchmark:
+-------------------------------------------------+---------+-----------------------+
Benchmark main patch
+=================================================+=========+=======================+
_csv.Dialect() 247 ns 193 ns: 1.28x faster
+-------------------------------------------------+---------+-----------------------+
_csv.Dialect().__replace__(** delimiter : , ) 1.82 us 1.52 us: 1.20x faster
+-------------------------------------------------+---------+-----------------------+
Geometric mean (ref) 1.24x faster
+-------------------------------------------------+---------+-----------------------+
Details
import pyperf
SETUP =
import _csv
CASES = [
( _csv.Dialect() , _csv.Dialect() ),
( _csv.Dialect().__replace__(** delimiter : , ) , _csv.Dialect().__replace__(** delimiter : , ) ),
]
runner = pyperf.Runner()
for name, stmt in CASES:
runner.timeit(name, stmt=stmt, setup=SETUP)
Issue: gh-162350;
Headings (most frequently used words):
uh, oh, for, navigation, gh, 162350, add, ac, vectorcall, _csv, dialect, 162499, are, footer, you, diff, view, menu, repository, there, no, files, selected, viewing, sure, want, to, change, the, base, filter, by, extension,
Text of the page (most frequently used words):
struct_for_id (50), pyobject (29), file (28), null (25), github (19), expand (17), this (16), and (15), changes (14), loading (14), the (12), reload (12), for (12), applied (11), all (11), dialect (11), show (11), while (10), line (10), code (10), _csv (10), open (10), files (10), you (9), object (9), c_default (9), none (9), diff (9), include (9), internal (9), not (8), please (8), comments (8), there (8), that (7), suggestion (7), cannot (7), suggestions (7), was (7), error (7), page (7), retry (7), down (7), struct (7), self (7), learn (7), about (7), view (7), load (7), sign (7), add (6), static (6), clinic (6), generated (6), skipinitialspace (6), quoting (6), quotechar (6), lineterminator (6), escapechar (6), doublequote (6), delimiter (6), hidden (6), characters (6), unicode (6), more (6), delete (6), default (6), _py_global_strings (6), tanloong (6), commits (6), security (5), from (5), change (5), oops (5), something (5), went (5), wrong (5), dialect_new (5), return (5), type (5), strict (5), vectorcall (5), desktop (5), edit (5), additions (5), deletions (5), are (5), base (5), your (5), can (4), 2026 (4), pull (4), args (4), newargs (4), pytypeobject (4), number (4), bidirectional (4), may (4), review (4), modules (4), some (4), branch (4), support (4), copilot (4), community (3), navigation (3), request (3), merge (3), batch (3), commit (3), const (3), input (3), module_state (3), _csv_state_from_type (3), char (3), what (3), rendered (3), how (3), customized (3), appear (3), pycore_unicodeobject_generated (3), pycore_runtime_init_generated (3), pycore_global_strings (3), pycore_global_objects_fini_generated (3), hide (3), whitespace (3), filter (3), nov (3), main (3), 162499 (3), 162350 (3), refname (3), python (3), account (3), quality (3), another (3), tab (3), window (3), refresh (3), session (3), developers (3), changelog (3), customer (3), enterprise (3), grade (3), features (3), build (3), contact (2), status (2), privacy (2), terms (2), footer (2), outdated (2), single (2), one (2), viewing (2), toggle (2), dialect_dealloc (2), dialect_methods (2), py_type (2), result (2), py_decref (2), end (2), output (2), dialectobj (2), _csvstate (2), dialect_kws (2), kwargs (2), 473 (2), name (2), 457 (2), original (2), contains (2), text (2), interpreted (2), compiled (2), differently (2), than (2), appears (2), below (2), editor (2), reveals (2), event (2), 434 (2), selected (2), apply (2), split (2), unified (2), failed (2), jump (2), nbsp (2), extension (2), into (2), csv_vectorcall (2), select (2), tree (2), old (2), could (2), tags (2), branches (2), issue (2), insights (2), projects (2), actions (2), repository (2), cpython (2), signed (2), with (2), universe (2), training (2), integrations (2), stories (2), center (2), documentation (2), business (2), fixes (2), products (2), secret (2), perform, action, time, share, personal, information, manage, cookies, docs, inc, right, now, check, back, later, queued, multi, pending, reviews, has, been, marked, resolved, must, existing, order, create, valid, applying, deleted, lines, supported, only, per, subset, closed, invalid, because, were, made, annotations, notes, py_tp_clear, dialect_clear, py_tp_dealloc, py_tp_methods, py_tp_vectorcall, dialect_vectorcall, py_tp_new, py_tp_getset, dialect_getsetlist, py_tp_members, dialect_memberlist, 719, 701, pytype_slot, dialect_type_slots, pymethoddef, pydict_get_size, dialect_new_helper, pytuple_pack, 8f692c2c63a61b50, 154beb565fbabd4c, _csv_dialect___replace___impl, 676, 661, ooooooooo, pyarg_parsetupleandkeywords, ret, 123393bdc71ddaa6, a9977678df813ece, dialect_new_impl, start, __new__, classmethod, 486, sort, sock, sleep, skip_non_matching_threads, skip_file_prefixes, sizehint, 827, 834, read, raw, random_func, quotetabs, queuetype, query, qualname, 761, 766, locale, little, lineno, line_buffering, 630, 634, exc, eventmask, errors, error_rate, env, 470, duration_sec, dst_dir_fd, dst, dont_inherit, done, doc, 452, 454, digest, difference_update, dict, device, deterministic, detect_types, desired_access, depth, defaultaction, conversations, clear, filters, viewed, types, regenerate, precompiled, identifiers, 130f4bf, 42458dc, aff38d3, hold, shift, click, range, changed, checks, conversation, 252, wants, removed, timeline, become, sure, want, nothing, found, choose, already, clicking, agree, our, occasionally, send, related, emails, statement, service, free, its, maintainers, have, question, project, new, items, requests, issues, message, dismiss, alert, switched, accounts, out, appearance, settings, search, pricing, talks, workshops, next, partners, company, forum, events, webinars, blog, resource, connect, resources, premium, advanced, ons, trust, why, evaluate, see, industries, government, manufacturing, financial, services, healthcare, industry, nonprofits, startups, team, enterprises, stage, businesses, source, latest, improvements, across, place, developer, articles, sponsors, trending, repos, explore, customize, certifications, scanning, leak, prevention, protection, vulnerability, detection, remediation, secure, cloud, development, environments, codespaces, analysis, enforcement, automation, ship, coding, agent, tasks, automated, work, hosting, collaboration, platform, menu, skip, content,
|