<commit_before>#include <iostream>
#include "UmlFactory.hpp"
#include "Package.hpp"
#include "Class.hpp"
#include "Property.hpp"
#include <string>
#include <chrono>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>

#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()

using namespace std;

int main(int argc, char *argv[])
{
    cout << "Hello World!" << endl;

    uml::UmlFactory* umlFactory = uml::UmlFactory::eInstance();
    cout << "factory created " << umlFactory << endl;
    uml::Package* package = umlFactory->createPackage();
       cout << "package created" << endl;
    package->setName(std::string("Benchmark UML"));
    cout << package->getName() << endl;

    char buffer [33];

    std::chrono::time_point<std::chrono::high_resolution_clock> start, end;
    start = std::chrono::high_resolution_clock::now();
    for (int i=0; i<100000; i++)
    {
        uml::Class* classObject = umlFactory->createClass();
        classObject->setName("Class " + sprintf (buffer, "%i", i));
        uml::Property* property = umlFactory->createProperty();
        property->setName("A" + sprintf (buffer, "%i", i));
        classObject->getAttribute()->push_back(property);
        package->getOwnedMember()->push_back(classObject);
    }
    end = std::chrono::high_resolution_clock::now();
    delete (package);
    std::cout << std::chrono::duration_cast<std::chrono::microseconds>(end-start).count() << std::endl;
    std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count() << std::endl;
    std::cout << std::chrono::duration_cast<std::chrono::seconds>(end-start).count() << std::endl;




    return 0;
}<commit_msg>UMLBenchmark updated - add shared_ptr use, benchmark improvement<commit_after>#include <iostream>
#include "UmlFactory.hpp"
#include "Package.hpp"
#include "Class.hpp"
#include "Property.hpp"
#include <string>
#include <chrono>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()

using namespace std;

int main(int argc, char *argv[])
{
    cout << "Hello World!" << endl;

	for (int i=0; i<100; i++){
	
    shared_ptr<uml::UmlFactory> umlFactory = uml::UmlFactory::eInstance();
    cout << "factory created " << umlFactory << endl;
    std::chrono::time_point<std::chrono::high_resolution_clock> start, end;
	{
		shared_ptr<uml::Package> package(umlFactory->createPackage());
		cout << "package created" << endl;
		package->setName(std::string("Benchmark UML"));
		cout << package->getName() << endl;

		char buffer [33];

		start = std::chrono::high_resolution_clock::now();
		for (int i=0; i<100000; i++)
		{
			shared_ptr<uml::Class> classObject(umlFactory->createClass());
			classObject->setName("Class " + sprintf (buffer, "%i", i));
			shared_ptr<uml::Property> property(umlFactory->createProperty());
			property->setName("A" + sprintf (buffer, "%i", i));
			classObject->getAttribute()->push_back(property);
			package->getPackagedElement()->push_back(classObject);
		}
		end = std::chrono::high_resolution_clock::now();
		std::cout << std::chrono::duration_cast<std::chrono::microseconds>(end-start).count() << std::endl;
		std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count() << std::endl;
		std::cout << std::chrono::duration_cast<std::chrono::seconds>(end-start).count() << std::endl;
		
		std::cout << "count: " << package->getPackagedElement()->size() << std::endl;;
		
		std::cout << "time for delete" << std::endl;
		start = std::chrono::high_resolution_clock::now();
	}
    
	end = std::chrono::high_resolution_clock::now();
    std::cout << std::chrono::duration_cast<std::chrono::microseconds>(end-start).count() << std::endl;
    std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count() << std::endl;
    std::cout << std::chrono::duration_cast<std::chrono::seconds>(end-start).count() << std::endl;

	}
	Sleep( 10000000 ); 
    return 0;
}
{'fraction_non_alphanumeric': 0.1978505129457743, 'fraction_numerical': 0.007816316560820713, 'mean_word_length': 5.232876712328767, 'pattern_counts': {'":': 0, '<': 126, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5269045', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1350, 'n_words': 246}