Preheat your oven to 325°F (163°C). Grease and flour a 9x13-inch baking pan.
In a large bowl, whisk together sugar, oil, eggs, and vanilla until well combined.
In a separate bowl, mix flour, baking soda, salt, and cinnamon.
Gradually stir the dry ingredients into the wet mixture until just combined.
Fold in the chopped apples and walnuts, if using.
Pour the batter into the prepared pan and smooth the top with a spatula.
Bake for about 50 minutes, or until a toothpick inserted in the center comes out clean.
Let it cool in the pan for 10-15 minutes before slicing. Serve warm or at room temperature.