Commit Graph

43 Commits

Author SHA1 Message Date
Slava Pestov
0aece0c28e We need at least 7 samples for scale-test to produce a reliable result
One test was miscategorized as 'fast' because of this issue, but it
would occasionally fail. It turns out it always fails once you ask
for 7 points or more, so let's fix that and move it back to 'slow'.

Fixes rdar://162597936.
2025-10-15 16:13:25 -04:00
Slava Pestov
b4b873332f Update -requirement-machine-* flags in various tests
- Don't pass 'verify' since it's now the default
- Update tests where diagnostics changed in a correct way to pass 'on' instead
- Delete compiler_scale/explicit_requirements_perf.swift since it's not testing anything with the requirement machine
2022-03-31 15:57:36 -04:00
Slava Pestov
3beb3529b4 Move test/Generics/explicit_requirements_perf.swift to validation-test/compiler_scale
All other scale-tests are in validation-test, so move this one there
too to speed up non-validation test runs.

Also this fixes the failure on Windows, where we don't run validation
tests yet.
2021-05-10 14:08:16 -04:00
Doug Gregor
9d333ee0ad Fix a crash 2021-03-02 07:11:09 -08:00
Alexis Laferrière
41e1c5a936 Revert "[Tests] Disable process-stats-dir.py related tests"
This reverts commit f576bebaf1.
2021-02-08 14:27:43 -08:00
Alexis Laferrière
efb7829741 Revert "Revert "[Tests] Disable process-stats-dir.py related tests"" 2021-02-05 10:06:18 -08:00
Alexis Laferrière
ef6fdf8af5 Revert "[Tests] Disable process-stats-dir.py related tests"
This reverts commit f576bebaf1.
2021-02-03 17:26:56 -08:00
Alexis Laferrière
f576bebaf1 [Tests] Disable process-stats-dir.py related tests 2021-02-01 10:22:10 -08:00
Rintaro Ishizaki
0a72d023f3 [TypeChecker] Rename 'typeCheckAbstractFunctionBodyUntil()'
to 'typeCheckAbstractFunctionBodyNodeAt()' because that only typecheck
a statement at the position.
2020-05-29 14:45:04 -07:00
Slava Pestov
06855f758d AST: Remove a couple of redundant statistics 2020-02-12 18:29:27 -05:00
Robert Widmann
28b66f6225 Switch DeclValidation Counter to Request Counter
Now that validateDecl is gone, stop duplicating work here and use the
request counter instead.
2019-10-28 15:36:50 -07:00
Jordan Rose
1eaa767407 [test] Run scale-tests on Linux too (#27223)
It's likely that these were listed as "REQUIRES: OS=macosx" to not
redundantly run them for iOS et al, but they don't take that long and
so it's more useful for Linux devs to be able to run them locally if
need be. Or to catch something that really is different on non-macOS.
2019-09-18 08:27:37 -07:00
Jordan Rose
dc59cd2043 [Sema] Stop visiting existential exprs an extra time checking for uses (#27150)
This was causing an exponential amount of time traversing the AST with
deeply chained protocol extension methods, such as in the
TestCodableRouter.swift test in Kitura.

If the OpaqueValueExpr is referenced more than once within the
OpenExistentialExpr it'll still get visited more than once, but that
doesn't seem to happen in practice. If it turns out to be a problem,
we can weaken the assertion I'm adding here.

https://bugs.swift.org/browse/SR-11012
2019-09-12 20:21:22 -07:00
Slava Pestov
2f33356083 AST: Optimize construction of the AnyObject dispatch table
Instead of visiting all members of all types and extensions, bail out
early if the type is not a class or protocol, or the extension is not
extending a class. This means we don't visit structs, enums or
protocol extensions at all, which will avoid delayed parsing.

Also, we were evaluating isObjC() on each member, which is an expensive
operation; if the member does not have an explicit @objc we would still
have to check if it overrides an @objc method or witnesses an @objc
protocol requirement.

Since most members are not ever found by dynamic lookup, this is wasted
work. Instead, let's rely on AnyObject lookup filtering non-@objc
members at the call site, which it was already doing anyway.
2019-08-12 17:55:44 -04:00
Slava Pestov
14d0bbfc5e AST: Optimize construction of the global name lookup table
Only visit bodies of types and extensions that may possibly contain
operator definitions.
2019-08-12 17:15:51 -04:00
Slava Pestov
5370ac0f03 compiler_scale tests should run full pipeline instead of just -typecheck
Now that SILGen and IRGen can trigger type checking work, we have to run the
full pipeline to get a complete picture.

Thankfully everything still passes!
2019-07-17 18:07:03 -04:00
Slava Pestov
4fa48473bc Sema: Stop finalizing struct and enum members
Since getStoredProperties() is a request that lowers lazy properties
and property wrappers to their underlying storage, and SIL can validate
stored property and enum element types, there's no longer any need for
Sema to explicitly finalize members of structs and enums. SILGen can
trigger any necessary type checkin work just by lowering a struct or
enum type.

Now the only remaining reason we need finalizeDecl() is adding implicit
methods to classes, and synthesizing accessors for storage in classes
and protocols.
2019-07-17 18:07:03 -04:00
Slava Pestov
83c90b6b2a AST: Turn NominalTypeDecl::getStoredProperties() into a request
This improves on the previous situation:

- The request ensures that the backing storage for lazy properties
  and property wrappers gets synthesized first; previously it was
  only somewhat guaranteed by callers.

- Instead of returning a range this just returns an ArrayRef,
  which simplifies clients.

- Indexing into the ArrayRef is O(1), which addresses some FIXMEs
  in the SIL optimizer.
2019-07-16 16:38:38 -04:00
Slava Pestov
4551230a8b Sema: Remove ConformanceCheckFlags::Used 2019-05-28 22:08:31 -04:00
Andrew Trick
8f84429565 Add a scale-test for VarDecl::getStoredProperties.
Adds a NumStoredPropertiesQueries stat.

Adds a test case for an increasing number of lazy stored class
properties. Each property requires a formal access within the
initializer. This would manifest as cubic behavior in
AccessEnforcementOpts, which scales as O(1.5) in the above stat.
2019-05-13 16:54:55 -07:00
Slava Pestov
93c386d263 Parse: Skip function bodies when delayed member parsing mode is on
Fixes <rdar://problem/47305142>.
2019-01-18 00:15:53 -05:00
Rintaro Ishizaki
22652f9e88 [Parse] Eliminate backtracking in collection expression parsing
Parsing collection literal expression used to take exponential time
depending on the nesting level of the first element.

Stop using 'parseList()' because using it complicates libSyntax parsing.

rdar://problem/45221238 / https://bugs.swift.org/browse/SR-9220
rdar://problem/38913395 / https://bugs.swift.org/browse/SR-7283
2018-12-25 11:05:23 +09:00
Andrew Trick
8de89c392a Add a scale-test validation test for quadratic behavior during inlining.
Adds a stat to SILInstruction's transferNodesFromList to record the
number of times an instruction is transfered to another block. This is
the only way I can think of to detect quadratic behavior of passes
that split basic blocks.
2018-11-26 15:24:41 -08:00
Slava Pestov
4ab28fb63c Add scale test for nested type extension binding
This performance problem was fixed a while ago by Doug's request
evaluator work.
2018-09-14 14:31:46 -07:00
Xi Ge
3f03202ba7 test: add a scale test for the number of IterableDeclContext getting parsed. 2018-09-12 14:20:56 -07:00
Slava Pestov
47c6117a9b Sema: Remove deprecated SWIFT_FUNC_STAT counters 2018-03-06 19:42:52 -08:00
Slava Pestov
6065168928 Parse: Test that we only parse function bodies in primary files
I added this optimization a while ago but didn't add a test for it.
2018-03-06 19:42:43 -08:00
Slava Pestov
3f51dbc3b1 Sema: Don't validate types when binding extensions 2017-11-15 21:55:55 -08:00
Slava Pestov
772bd7634c Sema: Lazily validate protocol members 2017-11-15 16:26:27 -08:00
Slava Pestov
31176d713a Sema: Only validate all members of a class if we access one of its members
... Or if we subclass it, or define an extension of it.
2017-10-22 20:05:01 -07:00
Max Moiseev
fe4553eb80 Merge branch 'master' into new-integer-protocols 2017-04-11 17:07:11 -07:00
Huon Wilson
3f712ad87c [scale-test] Diagnose exponential growth explicitly.
This, somewhat questionably, fits the polynomial model and the
exponential model, and then chooses the one with the best R^2. However,
no matter how statistically valid this is, it works reasonably in
practice.

Slow growing things sometimes get classified as 1.0^n or 1.1^n, but
these are either spurious or not relevant, and so a similar thresholding
to the polynomial fit is used.
2017-04-10 13:22:16 -07:00
Max Moiseev
8ffbc81239 Fixing some validation tests 2017-03-10 17:09:28 -08:00
Slava Pestov
20b13bde5f scale_tests require an asserts build 2017-01-08 23:54:01 -08:00
Slava Pestov
02185c30ee Sema: When validating members for layout, skip certain members
For all types, we can safely skip nested nominal types and
typealiases.

For a struct, we only have to look at VarDecls; methods never
affect layout.

Similarly for an enum, only EnumElementDecls matter.

For a class, we still have to look at all methods and properties.
Ideally, in non-optimized builds we would invoke virtual methods
by calling thunks, and only emit the thunks from the translation
unit containing the class. Then the layout of a class will
only be necessary if you subclass the class.

This should improve compiler scalability in multiple-frontend
mode.
2017-01-08 21:01:14 -08:00
Slava Pestov
8d46ec4713 Actually enable scale-tests 2017-01-08 18:12:48 -08:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Graydon Hoare
a5c1fb4e2a [Compile Perf] Add scale-test for BasicCalleeAnalysis, rdar://29279532 2016-11-17 11:58:58 -08:00
Graydon Hoare
1769325ec1 [Compile perf] Make scale-test conditional on assertions, rdar://29090287 2016-11-08 09:52:10 -08:00
Graydon Hoare
3d8f8e050c [Compile perf] Use lit tmpdir in scale-test, rdar://29090287 2016-11-07 15:57:33 -08:00
Ben Langmuir
9d441fc3d7 Disable compiler_scale test failing in CI
rdar://problem/29090287
2016-11-05 09:49:51 -07:00
Graydon Hoare
63f5a4b3ba Restrict scale-test to macosx, avoid breaking simulators. 2016-11-03 09:24:16 -07:00
Graydon Hoare
e2a7a891ff [Compile perf] rdar://27397701 Add multifile accessor scale-test 2016-11-02 10:00:18 -07:00