Skip to content

protyagov/StructVsClassPerformance

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Demonstrates how structures can be more performant than classes using Swift 4 version.

Tests are done for structs/classes with 1 and 10 fields.

**SIMILATOR iOS11**
- Using default debug settings:
    - struct static func is about 20% faster than class func.
- Using Swift Compiler -O -whole-module-optimization
    - struct static func is about 38% faster than class func.

On real device performance of static func vs global func vs class func is exactly the same.
Only performance difference is when instances or struct OR class are used.


Compiler settings:
LLVM -Ofast
Swift Compiler -O -whole-module-optimization

About

A demonstration of how much structures can be more performant than class.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Swift 100.0%