Created
          January 29, 2017 17:50 
        
      - 
      
- 
        Save bahrmichael/bb9e89de762c0db9df074294059d1ece to your computer and use it in GitHub Desktop. 
    Test ccp api speed
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from datetime import datetime | |
| import evelink | |
| class App: | |
| eve = evelink.eve.EVE() | |
| def main(self): | |
| result = self.iterate(100000) | |
| minimum_duration = min(result) | |
| calls_per_second = int(1000 / minimum_duration) | |
| print("maximum calls per second: %d" % calls_per_second) | |
| def iterate(self, count): | |
| result = [] | |
| for i in range(0, count): | |
| before = datetime.now() | |
| self.do_call() | |
| after = datetime.now() | |
| delta = after - before | |
| result.append(delta.microseconds) | |
| if i % 1000 == 0: | |
| print("%d%% done" % (int(i / count * 100))) | |
| return result | |
| def do_call(self): | |
| self.eve.type_name_from_id(34) | |
| if __name__ == '__main__': | |
| App().main() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment