Speed up AppleScript

Good evening,
The script is a bit slow but it works very well … is there a way to speed it up?
Thanks so much


set oggi to (current date)
set FineGiugno to (current date)
set FineGiugno's month to 6
set FineGiugno's day to 30
set FineGiugno's time to 86399

tell application "Calendar"
	
	tell calendar "Paolo"
		set PrimaA to events whose summary is "1A" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		set SecondaA to events whose summary is "2A" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		set TerzaA to events whose summary is "3A" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		set PrimaB to events whose summary is "1B" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		set SecondaB to events whose summary is "2B" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		set TerzaB to events whose summary is "3B" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		set PrimaST to events whose summary is "1ST" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		set SecondaST to events whose summary is "2ST" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		set TerzaST to events whose summary is "3ST" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		set Bardellini to events whose summary is "2A - Agata Berdellini" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		set Orchestra to events whose summary is "Orchestra" and start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		
	end tell
	
end tell

set Conta_PrimaA to count PrimaA
set Conta_SecondaA to count SecondaA
set Conta_TerzaA to count TerzaA
set Conta_PrimaB to count PrimaB
set Conta_SecondaB to count SecondaB
set Conta_TerzaB to count TerzaB
set Conta_PrimaST to count PrimaST
set Conta_SecondaST to count SecondaST
set Conta_TerzaST to count TerzaA
set Conta_Bardellini to count Bardellini
set Conta_Orchestra to count Orchestra


Model: MacBook Pro (15-inch, 2017) 2,9 GHz Intel Core i7
Browser: Safari 537.36
Operating System: Mac OS X (10.13 Developer Beta 3)

Hi,

sending an Apple Event with filter clause to Calendar or Contacts is very, very expensive.

A way to speed up the code is to get all events in the time range once and use a repeat loop to filter the summaries.

This is an example with the first two summary values

set oggi to (current date)
set FineGiugno to (current date)
set FineGiugno's month to 6
set FineGiugno's day to 30
set FineGiugno's time to 86399

set Conta_PrimaA to 0
set Conta_SecondaA to 0

tell application "Calendar"
	tell calendar "Paolo"
		set allEvents to events whose start date is greater than or equal to oggi and start date is less than or equal to FineGiugno
		repeat with anEvent in allEvents
			set theSummary to summary of anEvent
			if theSummary is "1A" then
				set Conta_PrimaA to Conta_PrimaA + 1
			else if theSummary is "2A" then
				set Conta_SecondaA to Conta_SecondaA + 1
			end if
		end repeat
	end tell
end tell 

Another way is to use AppleScriptObjC and Shane Stanley’s CalendarLib EC script library which is certainly the fastest solution.